package com.yueka.mapper;

import com.yueka.pojo.statement.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface StatementMapper {
    @Select("select (select count(*) from student) as studentCount, (select count(*) from teacher) as teacherCount, sum(total_lessons) as totalLessonsSum, sum(finished_lessons) as finishedLessonsSum, (select count(*) from instrument_category) as instrumentCategoryCount from course")
    Statement getStatement();

    @Select("select source, count(*) as count from student group by source")
    List<StudentSourceCount> getStudentSourceCounts();

    @Select("select status, count(*) as count from student group by status")
    List<StudentStatusCount> getStudentStatusCounts();

    @Select("select ic_Id, ic_name, sum(total_lessons) as sum from course c, instrument_category ic where c.ic_Id = ic.id group by ic_Id;")
    List<CourseInstrumentCategorySum> getCourseInstrumentCategorySums();

    List<Trend> getStudentTrend(String start, String end);

    List<Trend> getRourseRecordTrend(String start, String end);
}
